<div id="bouncingParticlePhysicalSimulationMovingObject2" style="position: absolute; left: 0px; top:0px; width:100px; height:100px; /*-webkit-transform: rotateZ(45deg);*/ background-color:#5555ff; border-radius: 50px;"> </div>
<div id="bouncingParticlePhysicalSimulationFloor" style="position: absolute; left:0px; top:0px; width:1000px; height:10px; background-color:#333333;"> </div>
<div id="bouncingParticlePhysicalSimulationWall" style="position: absolute; left:0px; top:0px; width:400px; height:10px; background-color:#333333;"> </div>
<div id="bouncingParticleTestconsole" style="position: absolute; left: 50px; top:350px;"></div>
<button id="bouncingParticlePhysicalSimulationRestart" >Start over</button>
<script type="text/javascript">
var bouncingParticlePhysicalSimulation = new physHtml.main("bouncingParticlePhysicalSimulation");

function bouncingParticleTest()
{
  bouncingParticlePhysicalSimulation.initialize();  
  bouncingParticlePhysicalSimulation.maxTime = 15000;
  bouncingParticlePhysicalSimulation.console = document.getElementById("bouncingParticleTestconsole");
  var movingObject2 = new physHtml.particle;

  function initialize(){
    movingObject2.gravity = $V([0.0, 10 * 9.8]);
    movingObject2.radius = 50.0;
    movingObject2.width = 100;
    movingObject2.height = 100;
    movingObject2.position = $V([0.0, 300.0]);
    movingObject2.velocity = $V([50.0, -100.0]);
    movingObject2.lastUpdatedTime = 0;
  }

  initialize();

  var floor = new physHtml.wall( $V([1, 400]), 0.0, 1000, 10, 0.8 );

  var wall = new physHtml.wall($V([200, 200]), -90.0, 400, 10, 0.8);
  
  movingObject2.connect(floor, floor);
  movingObject2.connect(wall, wall);

  var movingObject2HTML = new physHtml.htmlObject(document.getElementById('bouncingParticlePhysicalSimulationMovingObject2'), movingObject2);
  var floorObjectHTML = new physHtml.htmlObject(document.getElementById('bouncingParticlePhysicalSimulationFloor'), floor);
  var wallObjectHTML = new physHtml.htmlObject(document.getElementById('bouncingParticlePhysicalSimulationWall'), wall);

  bouncingParticlePhysicalSimulation.htmlObjects.addObject( movingObject2HTML );
  bouncingParticlePhysicalSimulation.htmlObjects.addObject( floorObjectHTML );
  bouncingParticlePhysicalSimulation.htmlObjects.addObject( wallObjectHTML );
  bouncingParticlePhysicalSimulation.physicalObjects.addObject( movingObject2 );

  document.getElementById('bouncingParticlePhysicalSimulationRestart').addEventListener('click', function() {
    initialize();

    if (bouncingParticlePhysicalSimulation.elapsedTime >= bouncingParticlePhysicalSimulation.maxTime){
      bouncingParticlePhysicalSimulation.initialize();  
      bouncingParticlePhysicalSimulation.maxTime = 15000;  
      bouncingParticlePhysicalSimulationPhysicalSimulation.elapsedTime = 0;
      bouncingParticlePhysicalSimulationPhysicalSimulation.start();
    }
    else{
      bouncingParticlePhysicalSimulation.elapsedTime = 0;
    }
  });

  bouncingParticlePhysicalSimulation.start();

  return true;
}
</script>
